//
//  SiEatVC.swift
//  SiliUtility
//
//  Created by Li Dong on 2023/10/19.
//

import UIKit

class SiEatVC: SiBaseVC {
    
    @IBOutlet weak var pmdView: UIView!
    @IBOutlet weak var playBtn: UIButton!
    @IBOutlet weak var hintLabel: UILabel!

    
    private var dataList = [String]()
    private let CellID = NSStringFromClass(SiFoodCell.self)

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        title = "一会吃什么"
        rollView.dataList = SiFoodModel.foodList
        rollView.isHidden = true
        pmdView.addSubview(rollView)
        rollView.snp.makeConstraints { make in
            make.left.right.centerY.equalToSuperview()
            make.height.equalToSuperview()
        }
    }

    @IBAction func playHandler(_ sender: UIButton) {
        playBtn.isSelected = !playBtn.isSelected
        rollView.isHidden = false
        hintLabel.isHidden = true
        if playBtn.isSelected {
            rollView.dataList = SiFoodModel.foodList
            rollView.rollEnable = true
            rollView.startRoll()
        }else{
            rollView.rollEnable = false
            playBtn.setImage(UIImage(named: "img_again"), for: .normal)
        }
    }
    
    @IBAction func customHandler(_ sender: UIButton) {
        navigationController?.pushViewController(SiCustomFoodVC(), animated: true)
    }
    
    
    lazy var rollView: SiRollView = {
        let temp = SiRollView()
        return temp
    }()
}

